<template>
    <div style="height: 100vh">
        <vab-only-office :option="option" style="height: 1000px" />
    </div>
</template>

<script>
/* eslint-disable */
import vabOnlyOffice from './VabOnlyOffice.vue';

export default {
    props: {
        fileName: {
            type: String,
            required: true
        },
        user: {
            type: Object,
            required: true
        }
    },
    components: {
        vabOnlyOffice,
    },
    data() {
        return {
            //参考vabOnlyOffice组件参数配置
            option: {
                url: '',
                isEdit: true,
                fileType: '',
                title: '文档编辑',
                lang: 'zh-CN',
                isPrint: true,
                user: null,
            },
            show: false,
        };
    },
    mounted() {
        // @ts-ignore
        let newPhysicalPathPath = this.$route.query.physicalPath.replace("/主文件夹", "")
        this.option.url = `http://113.54.254.111:9998${newPhysicalPathPath}`;
        // @ts-ignore
        this.option.fileType = this.$route.query.fileName.split('.')[1];
        // @ts-ignore
        this.option.user = this.$route.query.user;
    },
    methods: {
        getFile() {
            this.show = true;  //OnlyOffice的配置选项
            // getAction('/file/selectById', { id: this.id }).then(res => {
            this.option.isEdit = false;
            this.option.lang = 'zh-CN';
            this.option.title = '123';
            this.option.fileType = 'docx';
            this.option.isPrint = false;
            // this.option.user = { id: 12, name: '张三' };
            // })
        },
        close() {
            this.show = false;
        },
    },
};
</script>

<style>
html,
body {
    height: 100%;
}

#app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    height: 100%;
}

.qualityManual-container {
    padding: 0 !important;
    height: 100%;
}

.qualityManual-container-office {
    width: 100%;
    height: calc(100% - 55px);
}
</style>
